import { Column, CreateDateColumn, Entity, JoinTable, ManyToMany, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { RbacRole } from "./rbac_role.entity";

@Entity()
export class RbacUser {
    @PrimaryGeneratedColumn()
    id: number

    @Column({
        length: 50
    })
    username: string

    @Column({
        length: 50
    })
    password: string

    @CreateDateColumn()
    createTime: Date

    @UpdateDateColumn()
    updateTime: Date

    @ManyToMany(() => RbacRole)
    @JoinTable({
        name: 'rbac_user_role_relation'
    })
    roles: RbacRole[]
}
